/**
 *     This file is part of cesm-ws.
 *
 *     cesm-ws, Web Service for Community Earth System Model
 *
 *     Copyright (c) 2010, Purdue University and/or affilicates or thrid-party contributors as
 *     indicated by the @author tags or express copyright attribution statements
 *     applied by the authors. All third-party contributions are distributed under
 *     license by Purdue University.
 *
 *     cesm-ws is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with this distribution.  If not, see <http://www.gnu.org/licenses/>.
 */

package edu.purdue.rcac.cesm.ws.soap;

import javax.xml.ws.WebFault;

/**
 * This class helps to return soap fault as formatted xml string to client. In
 * SOAP interface, once CCSM4SOAPFault is thrown, a soap fault response is
 * automatically sent back to client.
 * 
 * @author Han Zhang
 * 
 */
@SuppressWarnings("serial")
@WebFault(name = "CESMSOAPFault")
public class CESMSOAPFault extends Exception {
	private CESMSOAPFaultBean faultInfo;

	public CESMSOAPFault(String message) {
		super(message);
		faultInfo = new CESMSOAPFaultBean();
		faultInfo.setMessage(message);
	}

	public CESMSOAPFault(String message, CESMSOAPFaultBean faultInfo) {
		super(message);
		this.faultInfo = faultInfo;
	}

	public CESMSOAPFault(Throwable cause) {
		super(cause);
		this.faultInfo = new CESMSOAPFaultBean();
		this.faultInfo.setMessage(cause.getMessage());
	}

	public CESMSOAPFault(Throwable cause, CESMSOAPFaultBean faultInfo) {
		super(cause);
		this.faultInfo = faultInfo;
	}

	public CESMSOAPFaultBean getFaultInfo() {
		return this.faultInfo;
	}
}
